import React from 'react'
import { Button } from 'antd'

export default function FormTitle(props) {
  const { title, add = false, addClick } = props
  return (
    <div
      style={{
        background: '#F5F7FA',
        width: '100%',
        borderRadius: 3,
        marginBottom: 12,
        display: 'flex',
        justifyContent: add ? 'space-between' : 'flex-start',
        height: 30,
        lineHeight: '30px',
      }}
    >
      <span style={{ marginLeft: 8 }}>{title}</span>
      {add ? (
        <Button type="link" onClick={addClick}>
          新增
        </Button>
      ) : null}
    </div>
  )
}
